package com.smallcc.converter;

import com.smallcc.dataobject.OrderMaster;
import com.smallcc.dto.OrderDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 晓风过境
 * @TODO    转换类
 * @date 2018/3/29 20:26
 * @day 29
 * @return $text$
 * @title ${CLASS_NAME}
 * @project_name sell
 */
public class OrderMaster2OrderDOTConverter {
    public static OrderDTO converter(OrderMaster orderMaster){
        OrderDTO orderDTO=new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }
    public static List<OrderDTO> converter(List<OrderMaster> orderMastersList){
        return  orderMastersList.stream().map(e->converter(e)).collect(Collectors.toList());
    }
}
